<?php
$this->breadcrumbs=array(
	'Demands'=>array('index'),
	'Manage',
);

$this->menu=array(
//	array('label'=>'List Demand', 'url'=>array('index')),
//	array('label'=>'Create Demand', 'url'=>array('create')),
	array('label'=>'Manage Society', 'url'=>array('society/admin')),    
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('demand-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Manage Demands</h1>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php
echo CHtml::beginForm();
?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'demand-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>
array(
		//'iddemand',
                array(
                  'header'=>'Society',
                  'value'=> '$data->idsociety0->societyname',
                  'htmlOptions' => array('width' => '20%', 'style'=>'text-align:center'),                
                ),
//		'idfinancialyear',
             /*   array(
                  'header'=>'Financial Year',
                  'value'=> '$data->idfinancialyear0->financialyear',
                  'htmlOptions' => array('width' => '20%', 'style'=>'text-align:center'),                
                ),*/
                array(
                  'header'=>'Stock Item',
                  'value'=> '$data->idstockitem0->itemname',
                  'htmlOptions' => array('width' => '20%', 'style'=>'text-align:center'),
                ),
            
//		'idstockitem',
//		'demandquantity',
//		'idsociety',
                array(
                    'header' => 'Quantity',
                    'value' => 'CHTML::textField("demandquantity[$data->iddemand]",$data->demandquantity,array(\'width\'=>20,\'maxlength\'=>30,\'style\'=>\'text-align:right\'))',
                    'type' => 'raw',
                    'htmlOptions' => array('width' => '15%', 'style'=>'text-align:center'),
                ),
            
		array(
			'class'=>'CButtonColumn',
                        'template' => '',                        
		),
	),
)); 

//echo CHTML::hiddenField('idsociety', $_REQUEST['idsociety'], array('size'=>10,'maxlength'=>10)); 

echo CHTML::button('Update Demand', array('submit' => Yii::app()->createUrl("demand/groupupdate")));

echo CHtml::endForm();
?>
